import request from '@/utils/request.js'

// 获取部门负责人数据
export const getEmployeeSimple = () => {
  return request.get('/sys/user/simple')
}

// 获取员工列表
export const getEmployeeList = (params) => {
  return request.get('/sys/user', {
    params
  })
}

// 删除员工
export function delEmployee (id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}

// 添加员工
export function addEmployee (data) {
  return request({
    method: 'post',
    url: '/sys/user',
    data
  })
}

// 批量导入员工
export function importEmployees (data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

// 修改员工的信息 API
export function saveUserDetailById (data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * @description: 为用户分配角色
 * @param {*} data { id:当前用户id, roleIds:选中的角色id组成的数组 }
 * @return {*}
 */
export function assignRoles (data) {
  return request({
    url: '/sys/user/assignRoles',
    data,
    method: 'put'
  })
}
